import React from 'react'
import {getAccOverallSuOrAc} from '../../../../financialApi'
import { Button, message, Space, Modal } from 'antd'
import { ExclamationCircleOutlined } from '@ant-design/icons';

const { confirm } = Modal;

const HangUpTodoAction = ({serialNo, listFun}) => {
    //激活
    const handleHangUp = () => {
        confirm({
            title: '确定要激活当前审批吗?',
            icon: <ExclamationCircleOutlined />,
            onOk() {
                const parames = {
                    isAct: false,
                    serialNo
                }
                    ; (async () => {
                        const { code, msg } = await getAccOverallSuOrAc(parames)
                        if (code === '20000') {
                            listFun()
                            message.success('挂起成功！')
                        } else {
                            message.error(msg)
                        }
                    })()
            }
        });
    }
    return <Space size="middle">
        <Button type='primary' onClick={() => handleHangUp()} >激活</Button>
    </Space>
}

export default HangUpTodoAction